<h1 class="th1">Q&A</h1>
<% if @qnas.each do |qna| %>
    <% if (qna.status == 0) && !current_user.nil? && current_user.admin? %>
          <div class="panel columns-12 fix-size">
              <div class="panel-segment-header-note col-1">
                Q</br></br><span style="font-size: 25px; color: #24b3ef;">A</span>
              </div>
              <div class="panel-segment-header-main col-11 col-offset-1">
                <div class="panel-segment-title2"><%= qna.question %></br></div>
                <div class="panel-segment-title3" id="qna-<%= qna.id %>">
                  <%= render 'qna_form_edit', :qna_instance => qna, :url_instance => 'qna_ans' %>
                </div>
              </div>
          </div>
    <% elsif (qna.status == 1) && !current_user.nil? && current_user.admin? %>
          <div class="panel columns-12 fix-size">
              <div class="panel-segment-header-note col-1">
                Q</br></br><span style="font-size: 25px; color: #24b3ef;">A</span>
              </div>
              <div class="panel-segment-header-main col-11 col-offset-1">
                <div class="panel-segment-title2"><%= qna.question %></br></div>
                <div class="panel-segment-title3" id="qna-<%= qna.id %>"><%= qna.answer %>
                  <%= form_for qna, url: {action: 'qna_edit'}, :remote => 'true' do |f| %>
                      <%= f.hidden_field :id, :value => qna.id %>
                      <%= f.submit 'Edit', :style => "position: relative; top: #{ !qna.answer.present? ? "-50" : "-70" }px; left: 80%;", :class => "btn btn-info" %>
                  <% end %>
                  <%= form_for qna, url: {action: 'qna_delete'}, method: :delete do |f| %>
                      <%= f.hidden_field :id, :value => qna.id %>
                      <%= f.submit 'Delete', :style => "position: relative; top: #{ !qna.answer.present? ? "-50" : "-70" }px; left: 90%;", :class => "btn btn-danger" %>
                  <% end %>
                </div>
              </div>
          </div>
    <% elsif qna.status == 1 %>
          <div class="panel columns-12 fix-size">
              <div class="panel-segment-header-note col-1">
                Q</br></br><span style="font-size: 25px; color: #24b3ef;">A</span>
              </div>
              <div class="panel-segment-header-main col-11 col-offset-1">
                <div class="panel-segment-title2"><%= qna.question %></br></div>
                <div class="panel-segment-title3" id="qna-<%= qna.id %>"><%= qna.answer %></br></div>
              </div>
          </div>
    <% end %>
<% end.empty? %>
<% end %>
